const express=require('express')


const mongoose=require('mongoose')

const app=express()


// mongodb://localhost/playing
mongoose.connect('mongodb://localhost/playing',{
    useNewUrlParser: true,
    useUnifiedTopology: true

}).then(res=>{
    console.log('连接数据库成功')
}).catch(err=>{
    console.log('连接数据库失败')
})

//创建集合规则
const MyConnetion=  new  mongoose.Schema({
    name:String,
    age:Number,
    date:Date,
    isFlag:Boolean
})

//使用创建的集合规则进行创建表 
const Sheet=mongoose.model('MySheet',MyConnetion)

//对表进行填充内容 


const MyContent=new Sheet({
    name:'李四',
    age:100,
    date:new Date().toDateString(),
    isFlag:false
})

MyContent.save()







app.listen(3001,()=>{
    console.log('3000连接成功')
})